package string;

/**
 * boolean startsWith(String str)
 * boolean endsWith(String str)
 * 判断当前字符串是否是以给定内容开始或结尾的
 */
public class StartsWithDemo {
    public static void main(String[] args) {
        String str = "www.tedu.com";
        //查看str是否是以"www."开始的
        boolean starts = str.startsWith("www.");
        System.out.println(starts);

        boolean ends = str.endsWith(".cn");
        System.out.println(ends);//false
        ends = str.endsWith(".com");
        System.out.println(ends);//true
    }
}



